package sv.com.renacempleo.web.controller.red;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletResponse;

import net.sf.json.JSONArray;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import sv.com.renacempleo.web.controller.BaseController;
import sv.com.renacempleo.web.util.DBContext;
@Controller
@RequestMapping("/formacion")
public class RedFormacionDemandanteController extends BaseController{
	
	private static final long serialVersionUID = 1739317906581281845L;

	@RequestMapping(value = "/doSearch", method = {RequestMethod.POST})
	public void doSeach(HttpServletResponse response, 
			Long redDemandanteFolio){
		Map<String, Object> result = new HashMap<String, Object>();
		try {
			List<Object[]> list = DBContext.getRedFormacionDemandanteDao().findAllFormacionAcademicaByDemandante(redDemandanteFolio);
			result.put("formacionAcademica",  JSONArray.fromObject(list));
		}catch (Exception e) {
			logger.error("Exception: ", e);
		}
		serializeObject(result, response);
		
	}

}
